#ifndef CONVERT_H
#define CONVERT_H

#include <stdint.h>

class Convert
{
public:
    Convert();

    static void Ascii2Hex(uint8_t *outBuffer, uint8_t *inBuffer, uint32_t len);
    static void Hex2Ascii(uint8_t *outBuffer, uint8_t *inBuffer, uint32_t len);
    static uint8_t BCD2Int(uint32_t *outNum, uint8_t *inBuffer, uint8_t len);
    static void Int2BCD(uint8_t *outBuffer, uint32_t inNum, uint8_t len);

    static uint32_t BCD2UInt(uint8_t*inBuffer, uint8_t len);

    static uint8_t QBH_BCD2Int(uint32_t *outNum, uint8_t *inBuffer, uint8_t len);
    static void QBH_Int2BCD(uint8_t *outBuffer, uint32_t inNum, uint8_t len);

    static uint32_t SparkLinkProtocol_BCD2Int(uint8_t *inBuffer, uint8_t len, uint8_t *ok = nullptr);
    static void SparkLinkProtocol_Int2BCD(uint8_t *outBuffer, uint32_t inNum, uint8_t len);

    static int32_t String2Int32(char *in);
    static float String2Float(char *in);
};

#endif // CONVERT_H
